local lfs = require("lfs")
local rtk = require("libluartk")

local gx = {}
function gx.enumProcesses()
	local procs = {}
	for f in lfs.dir("/proc") do
		local fpath = "/proc/" .. f
		if lfs.attributes(fpath, "mode") == "directory" and f:match("[0-9]+") then
			local rec = { id = tonumber(f) }
			rec.exe = rtk.getRealPath(fpath .. "/exe")
			if rec.exe then
				table.insert(procs, rec)
			end
		end
	end
	return procs
end

--require 'libluartk'
--tprint(gx.enumProcesses())

return gx
